package chixing.day09.homework.work7;


// 登录需要密码 + 管理码
public class AdminUser extends User implements Authenticatable {

    private  int manageCode;

    public AdminUser() {
    }

    public AdminUser(int manageCode) {
        this.manageCode = manageCode;
    }

    public AdminUser(String userName, String userPassword, int manageCode) {
        super(userName, userPassword);
        this.manageCode = manageCode;
    }

    @Override
    public boolean login(String username, String password) {
        if (this.getUserName().equals(username) && this.getUserPassword().equals(password) && manageCode == 999)
                return true;
            return false;
    }

    public int getManageCode() {
        return manageCode;
    }

    public void setManageCode(int manageCode) {
        this.manageCode = manageCode;
    }

    @Override
    public String toString() {
        return "AdminUser{" +
                "manageCode='" + manageCode + '\'' +
                '}';
    }
}
